<template>
  <!-- ref 如果是绑定在组件中，那么this.$refs.refname获取到的是组件
       ref 如果是绑定在标签上，那么this.$refs.refname获取到的是标签
  -->
  <div class="wrapper" ref="wrapper">
    <div class="content">
      <slot></slot>
    </div>
  </div>
</template>

<script>
import Bscroll from 'better-scroll'
import ObserveDOM from '@better-scroll/observe-dom'

export default {
  name: "Scroll",
  data() {
    return {
        scroll: null
    }
  },
  mounted() {
    this.scroll = new Bscroll(this.$refs.wrapper, {
      probeType: 2,
      click: true,
      pullUpLoad: true,
      observeDOM: true
    })
  },
  methods: {
    scrollTop(x, y, time=300) {
      this.scroll.scrollTo(x, y, time)
    }
  }
}
</script>

<style scoped>

</style>
